<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
</head>
<body>
<div style="padding-bottom:200px" class="layui-form layuimini-form">
    <!--<form class="layui-form" action="">-->
    <input type="hidden" name="id" value="{$res.id}" />

    <div class="layui-form-item">
        <label class="layui-form-label required">客服QQ</label>
        <div class="layui-input-block">
            <input type="text" value="{$res.qq}" name="qq" lay-verify="required" lay-reqtext="客服QQ不能为空"    class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">客服微信</label>
        <div class="layui-input-block">
            <input type="text" value="{$res.wechat}" name="wechat" lay-verify="required" lay-reqtext="客服微信不能为空"    class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">客服电话</label>
        <div class="layui-input-block">
            <input type="text" value="{$res.phone}" name="phone" lay-verify="required" lay-reqtext="客服电话不能为空"   class="layui-input">
        </div>
    </div>









    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>


    <!--</form>-->
</div>
{include file="public/footer" /}
<!--<script src="/static/admin/category/saveinfo.js?v={$Think.const.TIMESTAMP}" charset="utf-8"></script>-->
<script>
    layui.use(['form','upload'], function () {
        let form = layui.form,
            layer = layui.layer,
            $ = layui.$;


        //监听提交
        form.on('submit(saveBtn)', function (data) {

            let  postdata =data.field

            //发异步，把数据提交给php
            $.ajax({
                url: '/admin/apply/SaveServ?action=ajax',
                type: 'post',
                dataType: 'json',
                data:postdata,
                success: function(res) {
                    console.log( res)

                    if (res.status == true) {
                        layer.msg('保存成功', {icon: 1, time: 1000},
                            function(){
                                parent.location.reload();
                            })

                    }  else {
                        layer.open({
                            title: '错误信息',
                            content: '<span style="color:red">'+res.code+':</span>'+res.msg
                        })
                        return false
                    }
                },
                error: function(re) {

                    layer.open({
                        title: '错误信息',
                        content: '<span style="color:red">'+re.responseJSON.errorCode+':</span>'+re.responseJSON.msg
                    })
                }
            });




        });

    });
</script>


</body>
</html>